package com.daocao.jy.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.daocao.jy.R;


/**
 * Created by xsooy-pc on 2017/4/24.
 */

public class LoadingDialog extends Dialog {

    private Context mContext;
    private TextView tvTip;
    private View mView;

    public LoadingDialog(Context context) {
        this(context, R.style.loading_dialog);
    }

    public LoadingDialog(Context context, int themeResId) {
        super(context, themeResId);
        mContext = context;
        initView();
    }

    private void initView() {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        // 得到加载view
        mView = inflater.inflate(R.layout.dialog_loading, null);
        tvTip = (TextView) mView.findViewById(R.id.tv_loading_tip);
        setCancelable(true); // 不可以用"返回键"取消
        setCanceledOnTouchOutside(false);
        setContentView(mView);
    }

    public LoadingDialog setTip(String tip) {
        tvTip.setText(tip);
//        mView.setBackgroundResource(R.drawable.loading_dialog_bg);
        return this;
    }


}
